-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bare repo script #146
Merged
Merged
Bare repo script #146
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d814097
Script for creating new git bare repos and pushing to them
wnwright 75d6029
Adding better error handling
wnwright 5f22979
Fixing missing argument handling, and attempting to handle initiating…
wnwright 71919e5
Left some comments
wnwright 66ced74
Removing git push, fixing bracket issue, among other things
wnwright File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
usage() | ||
{ | ||
cat << EOF | ||
usage: new_bare_repo <hutch> <repo name> | ||
|
||
Script for automating the tedious process of integrating an existing IOC into our git bare repo scheme | ||
Run in the top level of your IOC | ||
|
||
Ex. new_bare_repo rix new_device | ||
(Creates a new bare repo in /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/rix/ named "new_device.git") | ||
|
||
You also might need to run kinit and aklog before hand! | ||
|
||
EOF | ||
} | ||
|
||
if [[ ($1 == "--help") || ($1 == "-h") ]]; then | ||
usage | ||
exit 0 | ||
|
||
elif [ $# -lt 2 ]; then | ||
echo 'Need to specify the hutch and name of the proposed bare repo' >&2 | ||
usage | ||
exit 1 | ||
|
||
fi | ||
|
||
HUTCH=$1 | ||
REPO=$2 | ||
CWD=$PWD | ||
|
||
set -e | ||
if [ ! -d "/afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/" ] | ||
echo "The directory /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/ does not exist!" | ||
wnwright marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exit 1 | ||
elif [ -d "/afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git" ] | ||
echo "There already exists a bare repo for this device!" | ||
exit 1 | ||
elif [ ${CWD} != *${REPO}* ] | ||
echo "Current working directory does not contain the name of the planned repo, check that you are running this script in the right place" | ||
exit 1 | ||
else | ||
git init | ||
ZLLentz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cp -u /cds/sw/tools/bin/eco_tools/gitignore.template .gitignore | ||
git add *.cfg Makefile .gitignore | ||
git commit -m "Initial commit" | ||
git-bare-repo /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git | ||
git remote add origin /afs/slac.stanford.edu/g/cd/swe/git/repos/package/epics/ioc/${HUTCH}/${REPO}.git | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR, I'm thinking we might want to add an engineering tools script that checks if kinit/aklog needs to be run (and optionally, runs it). This is doable using the output of the
klist
command.Would something like this have been useful when writing this script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I am not even sure when to run kinit or not... It's usually something I only run when I get an error message with git that I can't explain otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added an issue for this, I might get around to it at some point: #147