Граф коммитов

110 Коммитов

Автор SHA1 Сообщение Дата
Junio C Hamano abcb49cb56 Merge branch 'lh/branch-rename'
* lh/branch-rename:
  git-branch: let caller specify logmsg
  rename_ref: use lstat(2) when testing for symlink
  git-branch: add options and tests for branch renaming

Conflicts:

	builtin-branch.c
2006-12-13 11:07:51 -08:00
Junio C Hamano 753f96a455 branch --color: change default color selection.
Showing local and remote branches in green and red was simply
overkill, as all we wanted was to make it easy to tell them
apart (local ones can be built on top by committing, but the
remote tracking ones can't).

Use plain coloring for local branches and paint remotes in red.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 10:55:21 -08:00
Andy Parkins a1158caead Colourise git-branch output
I wanted to have a visual indication of which branches are local and
which are remote in git-branch -a output; however Junio was concerned
that someone might be using the output in a script.  This patch
addresses the problem by colouring the git-branch output - which in
"auto" mode won't be activated.

I've based it off the colouring code for builtin-diff.c; which means
there is a branch color configuration variable that needs setting to
something before the color will appear.

The colour parameter is "color.branch" rather than "branch.color" to
avoid clashing with the default namespace for default branch merge
definitions.

This patch chooses green for local, red for remote and bold green for
current.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 00:56:25 -08:00
Lars Hjemli 678d0f4cbf git-branch: let caller specify logmsg
This changes the signature of rename_ref() in refs.[hc] to include a
logmessage for the reflogs.

Also, builtin-branch.c is modified to provide a proper logmessage + call
setup_ident() before any logmessages are written.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-05 23:50:57 -08:00
Lars Hjemli c976d415e5 git-branch: add options and tests for branch renaming
Extend git-branch with the following options:

  git-branch -m|-M [<oldbranch>] newbranch

The -M variation is required to force renaming over an exsisting
branchname.

This also indroduces $GIT_DIR/RENAME_REF which is a "metabranch"
used when renaming branches. It will always hold the original sha1
for the latest renamed branch.

Additionally, if $GIT_DIR/logs/RENAME_REF exists, all branch rename
events are logged there.

Finally, some testcases are added to verify the new options.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-05 23:50:57 -08:00
Junio C Hamano 67affd5173 git-branch -D: make it work even when on a yet-to-be-born branch
This makes "git branch -D other_branch" work even when HEAD
points at a yet-to-be-born branch.

Earlier, we checked the HEAD ref for the purpose of "subset"
check even when the deletion was forced (i.e. not -d but -D).
Because of this, you cannot delete a branch even with -D while
on a yet-to-be-born branch.

With this change, the following sequence that now works:

	mkdir newdir && cd newdir
	git init-db
	git fetch -k $other_repo refs/heads/master:refs/heads/othre
	# oops, typo
	git branch other othre
	git branch -D othre

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 23:10:23 -08:00
Lars Hjemli 75e6e21320 Add -v and --abbrev options to git-branch
The new -v option makes git-branch show the abbreviated sha1 + subjectline
for each branch.

Additionally, minimum abbreviation length can be specified with
--abbrev=<length>

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 20:52:54 -08:00
Andy Parkins bfcc921430 Add support to git-branch to show local and remote branches
Instead of storing a list of refnames in append_ref, a list of
structures is created.  Each of these stores the refname and a
symbolic constant representing its type.

The creation of the list is filtered based on a command line
switch; no switch means "local branches only", "-r" means "remote
branches only" (as they always did); but now "-a" means "local
branches or remote branches".

As a side effect, the list is now not global, but allocated in
print_ref_list() where it used.

Also a memory leak is plugged, the memory allocated during the
list creation was never freed.

It lays a groundwork to also display tags, but the command being
'git branch' it is not currently used.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 21:26:12 -08:00
Andy Parkins 5c1e235f0f Remove uneccessarily similar printf() from print_ref_list() in builtin-branch
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-02 17:39:58 -08:00
Lars Hjemli c31820c26b Make git-branch a builtin
This replaces git-branch.sh with builtin-branch.c

The changes is basically a patch from Kristian Hgsberg, updated
to apply onto current 'next'

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-23 20:43:49 -07:00