Page MenuHomePhabricator

Ignore detached git branches.
ClosedPublic

Authored by joshuaspence on Mar 9 2014, 5:28 AM.
Tags
None
Referenced Files
F14080988: D8466.diff
Fri, Nov 22, 5:54 PM
Unknown Object (File)
Thu, Nov 21, 9:31 AM
Unknown Object (File)
Sun, Nov 17, 11:37 AM
Unknown Object (File)
Wed, Nov 6, 5:29 PM
Unknown Object (File)
Wed, Oct 23, 11:27 PM
Unknown Object (File)
Oct 22 2024, 6:42 PM
Unknown Object (File)
Oct 11 2024, 4:06 PM
Unknown Object (File)
Oct 8 2024, 6:20 PM

Details

Summary

Fixes T4559.

It looks like the code currently (at least partially) handles this by checking for (no branch). I suspect that the behaviour of git has changed (I am running version 1.9.0) because I haven't figured out what state to be in to cause git to output (no branch).

Test Plan

Ran arc branch when on a detached branch.

Diff Detail

Repository
rARC Arcanist
Branch
detached
Lint
Lint Passed
Unit
Tests Passed

Event Timeline

joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence edited edge metadata.

I can't immediately get "no branch" either anymore. It looks like several states are possible in the source:

static char *get_head_description(void)
{
	struct strbuf desc = STRBUF_INIT;
	struct wt_status_state state;
	memset(&state, 0, sizeof(state));
	wt_status_get_state(&state, 1);
	if (state.rebase_in_progress ||
	    state.rebase_interactive_in_progress)
		strbuf_addf(&desc, _("(no branch, rebasing %s)"),
			    state.branch);
	else if (state.bisect_in_progress)
		strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
			    state.branch);
	else if (state.detached_from)
		strbuf_addf(&desc, _("(detached from %s)"),
			    state.detached_from);
	else
		strbuf_addstr(&desc, _("(no branch)"));
	free(state.branch);
	free(state.onto);
	free(state.detached_from);
	return strbuf_detach(&desc, NULL);
}

Those other two seem like very unusual times to run arc commands, though.

epriestley updated this revision to Diff 20077.

Closed by commit rARCa2706f653944 (authored by @joshuaspence, committed by @epriestley).