Re: [PATCH] Add support to git-branch to show local and remote branches

2 messages, 2 authors, 2016-08-11 · open the first message on its own page

Re: [PATCH] Add support to git-branch to show local and remote branches

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:31:28

Andy Parkins [off-list ref] writes:
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.  This is now done in the new
function, tidy_ref_list()
I would not call that a "leak" given that print_ref_list() is
the last thing to be called before the command exits.  I'd
rather not to spend cycles calling free().
+static int tidy_ref_list( struct ref_list *ref_list )
Style.  No spaces before or after parameter list.

I see you already parse "refs/tags" prefix. "git branch" would
not print tags, but that part might be useful when we want to
redo git-tag in C.

Other than that, I think it is equivalent to what I have in "pu"
right now.

Re: [PATCH] Add support to git-branch to show local and remote branches

From: Andy Parkins <hidden>
Date: 2016-08-11 19:49:40

On Friday 2006 November 03 12:08, Junio C Hamano wrote:
quoted
+static int tidy_ref_list( struct ref_list *ref_list )
Style.  No spaces before or after parameter list.
Bah!  It's so hard getting my fingers to remember what style goes in which 
project :-)
I see you already parse "refs/tags" prefix. "git branch" would
not print tags, but that part might be useful when we want to
redo git-tag in C.
I'm going to have a look at that soon; I've got enough of a hang of things 
with this git-branch work that I think I could cope with writing git-tag in 
C.


Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help