Page MenuHomePhabricator

Ignore detached git branches.
ClosedPublic

Authored by joshuaspence on Mar 9 2014, 5:28 AM.
Tags
None
Referenced Files
F13286021: D8466.diff
Tue, Jun 4, 5:55 AM
F13257601: D8466.id20076.diff
Sun, May 26, 3:06 AM
F13253075: D8466.diff
Sat, May 25, 2:22 AM
F13251245: D8466.id.diff
Fri, May 24, 9:31 PM
F13235543: D8466.diff
Tue, May 21, 5:52 AM
F13222713: D8466.id20077.diff
Sun, May 19, 3:53 AM
F13210645: D8466.diff
Fri, May 17, 5:04 AM
F13199514: D8466.id20077.diff
Mon, May 13, 3:36 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).