Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Clarify whether or not there are untracked changes #1006

Merged
merged 5 commits into from
Oct 29, 2017

Conversation

mjrlee
Copy link
Contributor

@mjrlee mjrlee commented Oct 17, 2017

Refer to issue #990 for an instance where this has caused confusion.

Copy link
Collaborator

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Hi @MartinLeedotOrg,

Thanks for the PR!

I tried this locally and I think it doesn't quite work the way you intended and now reports no untracked changes when there are in fact some.

$> git status
HEAD detached at se/pr/1006
nothing to commit, working tree clean

$> touch foobar.txt

$> git status
HEAD detached at se/pr/1006
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	foobar.txt

nothing added to commit but untracked files present (use "git add" to track)

$> git diff-index --quiet HEAD -- && echo "no" || echo "yes";
no

It might be easier to try and address this at the Jinja2 layer by using a default filter or some kind of check for an empty value.

Or maybe it's easier to try and unravel this weird Bash boolean logic. Up to you!

@cpu cpu added kind/cleanup kind/docs status/revisions-needed For items with outstanding requested changes labels Oct 18, 2017
@mjrlee
Copy link
Contributor Author

mjrlee commented Oct 22, 2017

I think this is because we're using git diff-index instead of git status.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
$ git diff-index  HEAD
$ touch foo
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    foo

nothing added to commit but untracked files present (use "git add" to track)
$ git diff-index HEAD
$ git add foo
$ git diff-index HEAD
:000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A  foo

@cpu
Copy link
Collaborator

cpu commented Oct 22, 2017

I think this is because we're using git diff-index instead of git status.

@MartinLeedotOrg Ahhh! That makes sense! Thanks for explaining. I understand now why an untracked file doesn't flip the status (and agree that it shouldn't). 👍

@cpu cpu removed the status/revisions-needed For items with outstanding requested changes label Oct 29, 2017
@cpu cpu merged commit 357ea72 into StreisandEffect:master Oct 29, 2017
@cpu
Copy link
Collaborator

cpu commented Oct 29, 2017

Thanks again @MartinLeedotOrg 🏆

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants