Skip to contentSkip to conversation

git diff-index and both deleted conflict

DISCUSSION Dmitry Pavlenko 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 2 lines · Dmitry Pavlenko

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