Skip to content

Commit 153eb40

Browse files
committed
Revert "Merge branch 'kj/stash-onbranch-submodule-fix' into next"
This reverts commit a5dae09, reversing changes made to e53466b to queue an updated version.
1 parent 1fc2a02 commit 153eb40

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

builtin/stash.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,6 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
13721372
const char *head_short_sha1 = NULL;
13731373
const char *branch_ref = NULL;
13741374
const char *branch_name = "(no branch)";
1375-
char *branch_name_buf = NULL;
13761375
struct commit *head_commit = NULL;
13771376
struct commit_list *parents = NULL;
13781377
struct strbuf msg = STRBUF_INIT;
@@ -1405,13 +1404,8 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
14051404

14061405
branch_ref = refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
14071406
"HEAD", 0, NULL, &flags);
1408-
1409-
if (flags & REF_ISSYMREF) {
1410-
if (skip_prefix(branch_ref, "refs/heads/", &branch_name))
1411-
branch_name = branch_name_buf = xstrdup(branch_name);
1412-
} else
1413-
branch_name = "(no branch)";
1414-
1407+
if (flags & REF_ISSYMREF)
1408+
skip_prefix(branch_ref, "refs/heads/", &branch_name);
14151409
head_short_sha1 = repo_find_unique_abbrev(the_repository,
14161410
&head_commit->object.oid,
14171411
DEFAULT_ABBREV);
@@ -1501,7 +1495,6 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
15011495
strbuf_release(&msg);
15021496
strbuf_release(&untracked_files);
15031497
free_commit_list(parents);
1504-
free(branch_name_buf);
15051498
return ret;
15061499
}
15071500

t/t3903-stash.sh

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,38 +1614,4 @@ test_expect_success 'stash apply reports a locked index' '
16141614
)
16151615
'
16161616

1617-
test_expect_success 'stash reflog message uses superproject branch, not submodule branch' '
1618-
git init sub_project &&
1619-
(
1620-
cd sub_project &&
1621-
echo "Initial content in sub_project" >sub_file.txt &&
1622-
git add sub_file.txt &&
1623-
git commit -q -m "Initial commit in sub_project"
1624-
) &&
1625-
1626-
git init main_project &&
1627-
(
1628-
cd main_project &&
1629-
echo "Initial content in main_project" >main_file.txt &&
1630-
git add main_file.txt &&
1631-
git commit -q -m "Initial commit in main_project" &&
1632-
1633-
git -c protocol.file.allow=always submodule add --quiet ../sub_project sub &&
1634-
git commit -q -m "Added submodule sub_project" &&
1635-
1636-
git checkout -q -b feature_main &&
1637-
cd sub &&
1638-
git checkout -q -b feature_sub &&
1639-
cd .. &&
1640-
1641-
git checkout -q -b work_branch &&
1642-
echo "Important work to be stashed" >work_item.txt &&
1643-
git add work_item.txt &&
1644-
git stash push -q -m "custom stash for work_branch" &&
1645-
1646-
git stash list >../actual_stash_list.txt &&
1647-
grep "On work_branch: custom stash for work_branch" ../actual_stash_list.txt
1648-
)
1649-
'
1650-
16511617
test_done

0 commit comments

Comments
 (0)