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.