summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67644a4)
raw | patch | inline | side by side (parent: 67644a4)
author | Shawn Pearce <spearce@spearce.org> | |
Fri, 19 May 2006 09:16:58 +0000 (05:16 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 19 May 2006 22:03:24 +0000 (15:03 -0700) |
When crating a new branch offer '-l' as a way for the user to
quickly enable ref logging for the new branch.
When deleting a branch also delete its ref log.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
quickly enable ref logging for the new branch.
When deleting a branch also delete its ref log.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-branch.txt | patch | blob | history | |
git-branch.sh | patch | blob | history |
index 72fb2f89b48ea1b80cd6c4a0bd57a9122e59ad79..a7bec3c101bf050347c0ef87d8529d6258926b58 100644 (file)
--------
[verse]
'git-branch' [-r]
-'git-branch' [-f] <branchname> [<start-point>]
+'git-branch' [-l] [-f] <branchname> [<start-point>]
'git-branch' (-d | -D) <branchname>...
DESCRIPTION
equal to that of the currently checked out branch.
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
-specify more than one branch for deletion.
+specify more than one branch for deletion. If the branch currently
+has a ref log then the ref log will also be deleted.
OPTIONS
-D::
Delete a branch irrespective of its index status.
+-l::
+ Create the branch's ref log. This activates recording of
+ all changes to made the branch ref, enabling use of date
+ based sha1 expressions such as "<branchname>@{yesterday}".
+
-f::
Force the creation of a new branch even if it means deleting
a branch that already exists with the same name.
diff --git a/git-branch.sh b/git-branch.sh
index d1e37307617abd6144f36f93decbebd95a97fb32..e0501ec23f5c40134af0e6211cf1ba28e69e1d5b 100755 (executable)
--- a/git-branch.sh
+++ b/git-branch.sh
#!/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>.'
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
}
force=
+create_log=
while case "$#,$1" in 0,*) break ;; *,-*) ;; *) break ;; esac
do
case "$1" in
-f)
force="$1"
;;
+ -l)
+ create_log="yes"
+ ;;
--)
shift
break
die "cannot force-update the current branch."
fi
fi
+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