Skip to content

Adds function to remove a stash entry - #7123

Closed
iAmWillShepherd wants to merge 7 commits into
the-last-stashfrom
drop-stash
Closed

iAmWillShepherd wants to merge 7 commits into
the-last-stashfrom
drop-stash

Conversation

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

⚠️ Review #7089 first if it isn't merged ⚠️

Adds a function that returns a list of stash entries.

See tracking issue: #6987

@iAmWillShepherd
iAmWillShepherd changed the base branch from development to the-last-stash March 19, 2019 21:22
@iAmWillShepherd iAmWillShepherd mentioned this pull request Mar 19, 2019
6 tasks done
William Shepherd added 2 commits March 19, 2019 16:32
Having this variable defined makes testing/debugging easier
await FSE.appendFile(readme, '2')
await stash(repository, 'master', null)

await dropDesktopStashEntry(repository, stashToDelete)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails with the following error:
Screen Shot 2019-03-19 at 4 46 46 PM

What's interesting about this is the stash entry actually is being deleted (inspecting stdout show's the message Dropped stash@{<object Id>} ...). I also did the same command on the CLI and received the following output:

/var/folders/jw/y2nmfz214vn4dvfv_qtxrhd00000gn/T/desktop-empty-repo-119219-33670-cmzh5g.x2vdj(master*) » git stash drop stash@{2a894b9e7a1689ffc741025e098bf8900d775700}
warning: Log for 'stash' only goes back to Tue, 19 Mar 2019 16:38:48 -0500.
warning: Log for 'stash' only goes back to Tue, 19 Mar 2019 16:38:48 -0500.
Dropped stash@{2a894b9e7a1689ffc741025e098bf8900d775700} (2a894b9e7a1689ffc741025e098bf8900d775700)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're tripping this code in Git (inside sha1_name.c): https://github.com/git/git/blob/0e94f7aa730b108f7907cfab1b2a7fba965de442/sha1-name.c#L864-L869

				if (!(flags & GET_OID_QUIETLY)) {
					warning("Log for '%.*s' only goes "
						"back to %s.", len, str,
						show_date(co_time, co_tz, DATE_MODE(RFC2822)));
				}

But how did it get there? I ran the test on the command line but with the GIT_TRACE=1 environment variable set to see more details about what happened:

$ GIT_TRACE=1 git stash drop stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}
10:37:01.182543 git.c:670               trace: exec: git-stash drop 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}'
10:37:01.182871 run-command.c:643       trace: run_command: git-stash drop 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}'
10:37:01.215751 git.c:670               trace: exec: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
10:37:01.216302 run-command.c:643       trace: run_command: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
10:37:01.228580 git.c:670               trace: exec: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
10:37:01.229155 run-command.c:643       trace: run_command: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
10:37:01.247404 git.c:419               trace: built-in: git rev-parse --git-dir
10:37:01.256372 git.c:419               trace: built-in: git rev-parse --git-path objects
10:37:01.271582 git.c:419               trace: built-in: git rev-parse --show-prefix
10:37:01.278427 git.c:419               trace: built-in: git rev-parse --show-toplevel
10:37:01.285749 git.c:419               trace: built-in: git rev-parse --git-path index
10:37:01.292660 git.c:419               trace: built-in: git config --get-colorbool color.interactive
10:37:01.299498 git.c:419               trace: built-in: git config --get-color color.interactive.help 'red bold'
10:37:01.306107 git.c:419               trace: built-in: git config --get-color  reset
10:37:01.314456 git.c:419               trace: built-in: git rev-parse --symbolic --verify --quiet 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}'
10:37:01.320790 git.c:419               trace: built-in: git rev-parse --verify --quiet 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}^2'
warning: Log for 'stash' only goes back to Wed, 20 Mar 2019 10:34:45 -0300.
10:37:01.337681 git.c:419               trace: built-in: git rev-parse --symbolic-full-name stash
10:37:01.344255 git.c:419               trace: built-in: git rev-parse --verify --quiet 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}^3'
warning: Log for 'stash' only goes back to Wed, 20 Mar 2019 10:34:45 -0300.
10:37:01.351753 git.c:419               trace: built-in: git reflog delete --updateref --rewrite 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}'
10:37:01.360711 git.c:670               trace: exec: git-sh-i18n--envsubst --variables 'Dropped ${REV} ($s)'
10:37:01.361153 run-command.c:643       trace: run_command: git-sh-i18n--envsubst --variables 'Dropped ${REV} ($s)'
10:37:01.372648 git.c:670               trace: exec: git-sh-i18n--envsubst 'Dropped ${REV} ($s)'
10:37:01.373152 run-command.c:643       trace: run_command: git-sh-i18n--envsubst 'Dropped ${REV} ($s)'
Dropped stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7} (d0504000f692e03c6fc84b96c92bc6b9708c0ab7)
10:37:01.384580 git.c:419               trace: built-in: git rev-parse --verify --quiet 'refs/stash@{0}'

This helps show the two places responsible for this message (both are git rev-parse --verify --quiet [oid]):

10:37:01.320790 git.c:419               trace: built-in: git rev-parse --verify --quiet 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}^2'
warning: Log for 'stash' only goes back to Wed, 20 Mar 2019 10:34:45 -0300
...
10:37:01.344255 git.c:419               trace: built-in: git rev-parse --verify --quiet 'stash@{d0504000f692e03c6fc84b96c92bc6b9708c0ab7}^3'
warning: Log for 'stash' only goes back to Wed, 20 Mar 2019 10:34:45 -0300.

I need to context switch on to other things, but I suspect proper error handling in here at some point should help it omit warning: messages like these...

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

Closing in favor of #7182.

@iAmWillShepherd
iAmWillShepherd deleted the drop-stash branch April 5, 2019 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants