Re: [PATCH] branch: fix funny-sounding error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 05, 2015 at 02:58:24PM -0700, Junio C Hamano wrote:

> I think this "branch is NULL" condition is when an earlier call to
> branch_get() returned a NULL, and _one_ way to make that happen is
> to detach the HEAD.  There may be others, but I didn't check.

FWIW, since I have just been looking through the branch code,
branch_get() should only return NULL when:

  1. We passed NULL or "HEAD" to it (i.e., we asked for the current branch). If
     you ask for a branch by name, you will always get a non-NULL return,
     even if that branch does not exist.

  2. There is no current branch (i.e., a detached HEAD).

I think the "no such branch" error message here:

               if (!branch) {
                        if (!argc || !strcmp(argv[0], "HEAD"))
                                die(_("could not unset upstream of HEAD when "
                                      "it does not point to any branch."));
			die(_("no such branch '%s'"), argv[0]);
	       }

cannot actually be triggered (and I double-checked that the test suite
does not trigger it by replacing it with "exit(141)", which should cause
even test_must_fail to complain).

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]