]> arthur.barton.de Git - bup.git/blobdiff - cmd/index-cmd.py
index: fix -H option
[bup.git] / cmd / index-cmd.py
index c2a22f913aa64bd2fe83f4a6b68812ed5837613b..b131db990264b9079c2b41e1c2007d16075c01ff 100755 (executable)
@@ -150,7 +150,8 @@ def update_index(top, excluded_paths, exclude_rxs, xdev_exceptions, out=None):
                 need_repack = True
             if not (rig.cur.flags & index.IX_HASHVALID):
                 if fake_hash:
-                    rig.cur.gitmode, rig.cur.sha = fake_hash(path)
+                    if rig.cur.sha == index.EMPTY_SHA:
+                        rig.cur.gitmode, rig.cur.sha = fake_hash(path)
                     rig.cur.flags |= index.IX_HASHVALID
                     need_repack = True
             if opt.fake_invalid:
@@ -305,7 +306,7 @@ if opt['print'] or opt.status or opt.modified:
             else:
                 line += b'  '
         if opt.hash:
-            line += hexlify(ent) + b' '
+            line += hexlify(ent.sha) + b' '
         if opt.long:
             line += b'%7s %7s ' % (oct(ent.mode), oct(ent.gitmode))
         out.write(line + (name or b'./') + b'\n')