[PATCH v3] branch: segfault fixes and validation

2013-02-23 Thread Nguyễn Thái Ngọc Duy
branch_get() can return NULL (so far on detached HEAD only) but some code paths in builtin/branch.c cannot deal with that and cause segfaults. While at there, make sure to bail out when the user gives 2 or more branches with --set-upstream-to or --unset-upstream, where only the first branch is

Re: [PATCH v3] branch: segfault fixes and validation

2013-02-23 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: What you can do is to have a single helper function that can explain why branch_get() returned NULL (or extend branch_get() to serve that purpose as well); then you do not have to duplicate the logic twice on the caller's side (and there