Page MenuHomePhabricator

Ignore detached git branches.
ClosedPublic

Authored by joshuaspence on Mar 9 2014, 5:28 AM.
Tags
None
Referenced Files
F13199514: D8466.id20077.diff
Mon, May 13, 3:36 PM
F13199513: D8466.id20076.diff
Mon, May 13, 3:36 PM
F13199505: D8466.id.diff
Mon, May 13, 3:33 PM
F13199497: D8466.diff
Mon, May 13, 3:29 PM
F13199210: D8466.diff
Mon, May 13, 12:51 PM
F13196328: D8466.diff
Sun, May 12, 11:11 PM
Unknown Object (File)
Fri, May 3, 3:28 AM
Unknown Object (File)
Mon, Apr 29, 2:44 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
Lint
Lint Skipped
Unit
Tests Skipped

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).