diff options
author | Junio C Hamano <junkio@cox.net> | 2006-05-23 15:07:47 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-23 15:07:47 -0700 |
commit | dcaad49c928f047d5ffa1c5a1753aff6e87f16b5 (patch) | |
tree | a688a7fcc3922b37fb72a5d52c00928ac5667bdb /git-branch.sh | |
parent | Merge branch 'eb/mailinfo' into next (diff) | |
parent | Merge part of 'js/fmt-patch' for RFC2822 dates into 'sp/reflog' (diff) | |
download | tgif-dcaad49c928f047d5ffa1c5a1753aff6e87f16b5.tar.xz |
Merge branch 'sp/reflog' into next
* sp/reflog:
Enable ref log creation in git checkout -b.
Create/delete branch ref logs.
Include ref log detail in commit, reset, etc.
Change order of -m option to update-ref.
Correct force_write bug in refs.c
Change 'master@noon' syntax to 'master@{noon}'.
Log ref updates made by fetch.
Force writing ref if it doesn't exist.
Added logs/ directory to repository layout.
General ref log reading improvements.
Fix ref log parsing so it works properly.
Support 'master@2 hours ago' syntax
Log ref updates to logs/refs/<ref>
Convert update-ref to use ref_lock API.
Improve abstraction of ref lock/write.
Diffstat (limited to 'git-branch.sh')
-rwxr-xr-x | git-branch.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git-branch.sh b/git-branch.sh index 134e68cf7f..e0501ec23f 100755 --- a/git-branch.sh +++ b/git-branch.sh @@ -1,6 +1,6 @@ #!/bin/sh -USAGE='[(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r' +USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r' LONG_USAGE='If no arguments, show available branches and mark current branch with a star. If one argument, create a new branch <branchname> based off of current HEAD. If two arguments, create a new branch <branchname> based off of <start-point>.' @@ -42,6 +42,7 @@ If you are sure you want to delete it, run 'git branch -D $branch_name'." esac ;; esac + rm -f "$GIT_DIR/logs/refs/heads/$branch_name" rm -f "$GIT_DIR/refs/heads/$branch_name" echo "Deleted branch $branch_name." done @@ -55,6 +56,7 @@ ls_remote_branches () { } force= +create_log= while case "$#,$1" in 0,*) break ;; *,-*) ;; *) break ;; esac do case "$1" in @@ -69,6 +71,9 @@ do -f) force="$1" ;; + -l) + create_log="yes" + ;; --) shift break @@ -117,4 +122,9 @@ then die "cannot force-update the current branch." fi fi -git update-ref "refs/heads/$branchname" $rev +if test "$create_log" = 'yes' +then + mkdir -p $(dirname "$GIT_DIR/logs/refs/heads/$branchname") + touch "$GIT_DIR/logs/refs/heads/$branchname" +fi +git update-ref -m "branch: Created from $head" "refs/heads/$branchname" $rev |