# git diff-index and both deleted conflict

2 messages from 2011-03-11 to 2011-03-11. Participants: Dmitry Pavlenko, Junio C Hamano.
Thread: https://gitlist.dev/t/26712

## Dmitry Pavlenko, 2011-03-11 16:47

Subject: git diff-index and both deleted conflict
Message-ID: <201103111947.55412.dmit10@mail.ru>
URL: https://gitlist.dev/e/201103111947.55412.dmit10%40mail.ru

```
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, 2011-03-11 17:28

Subject: Re: git diff-index and both deleted conflict
Message-ID: <7vlj0lzhvv.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vlj0lzhvv.fsf%40alter.siamese.dyndns.org
In-Reply-To: <201103111947.55412.dmit10@mail.ru>

```
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

```
