threads / discuss / 26712

git diff-index and both deleted conflict

Subject: git diff-index and both deleted conflict

## tl;dr

2 messages between Mar 11, 2011 and Mar 11, 2011.

replies: 1people: 2as markdown or json

Dmitry Pavlenko· Mar 11, 2011, 16:47 UTC · lore
Hello all,

Could you advise me the fastest way to check in my script that there's "no local changes in the repository (in the working tree and index)" so that I could perform "git rebase" there?

git svn dcommit" should check for the same because it performs rebase. "git svn dcommit" calls "git diff-index HEAD".

According to the documentation "git diff-index HEAD" performs the check I need. But I've discovered that in the case of "both deleted" conflict "git diff-index HEAD" outputs nothing but rebase still doesn't want to run.

So, at least either "git diff-index HEAD" or its documentation and "git-svn" should be fixed, I think.

And I'm still asking for the fastest method that could predict that working tree and index are clean, no conflict, and I can run "git rebase".

A simple script to generate "both deleted":
#!/bin/sh

git init touch foo git add foo git commit -m 'initial commit' git checkout -b tmp git mv foo X git commit -m 'rename to X' git checkout - git mv foo Y git commit -m 'rename to Y' git merge tmp git add Y git rm X

Junio C Hamano· Mar 11, 2011, 17:28 UTC · re: Dmitry Pavlenko · lore

Re: git diff-index and both deleted conflict

Dmitry Pavlenko <dmit10@mail.ru> writes:
> that there's "no local changes in the repository (in the working tree and 
> index)" so that I could perform "git rebase" there?

There is a code that lets "git rebase" decide if it can run in the source. Look for require_clean_work_tree in git-sh-setup.sh

← back to recent threads