fuzan / rietveld

Automatically exported from code.google.com/p/rietveld
Apache License 2.0
0 stars 0 forks source link

Unable to do upload.py for a just created file #467

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. git init
2. touch main.cpp
3. git add main.cpp
4. git commit -m "Add main.cpp"
5. echo 'int main() {return 0;}' > main.cpp 

6. python ./upload.py
  The following files are not added to version control:
  upload.py
  Are you sure to continue?(y/N) y
  Got error status from 'git show 192366843f474717330b743f88836af782d900b8'

Operating system:

  Ubuntu

  git --version                                                                                                                                                                                      
    git version 1.8.1.2

  shasum upload.py
    7d8589f90d2b12a8efe9158240944bac81a65a60  upload.py

  hg log upload.py
    changeset:   1176:2c314d786a1b
    branch:      chromium
    parent:      1172:4b3b1c9c3966
    parent:      1174:355577b0ddd8
    user:        Marc-Antoine Ruel <maruel@chromium.org>
    date:        Wed Oct 16 16:11:30 2013 -0400
    summary:     Merge default @ 355577b0ddd8

At what URL are you accessing Rietveld:

  codereview.appspot.com

The '192366843f474717330b743f88836af782d900b8' is a hash of new main.cpp 
content:

  git hash-object main.cpp
    192366843f474717330b743f88836af782d900b8

But since we have just created this file, it is not yet presented in the object 
database of the git.

  git show 192366843f474717330b743f88836af782d900b8
    fatal: bad object 192366843f474717330b743f88836af782d900b8

It seems, that the problem was exhibited after the following changes:

changeset:   1166:a6bd2dae7d87
user:        Marc-Antoine Ruel <maruel@chromium.org>
date:        Thu Sep 19 11:23:37 2013 -0400
summary:     Fix uploading binary files with git

     # Only include the "after" file if it's an image; otherwise it
     # it is reconstructed from the diff.
-    if is_image and hash_after:
-      new_content = self.GetFileContent(hash_after, is_binary)
-
+    if hash_after:
+      new_content = self.GetFileContent(hash_after)
+      is_binary = is_binary or self.IsBinaryData(new_content)
+      if not is_binary:
+        new_content = None

Original issue reported on code.google.com by the.zett@gmail.com on 29 Oct 2013 at 7:39

GoogleCodeExporter commented 9 years ago
The problem is with any change for me. hash_after is set even if file is not 
committed or added to staged area.

Original comment by techtonik@gmail.com on 11 Feb 2014 at 11:09

GoogleCodeExporter commented 9 years ago
Back link to ra6bd2dae7d87

Original comment by techtonik@gmail.com on 11 Feb 2014 at 11:25

GoogleCodeExporter commented 9 years ago
Chris had fixed it for the "commit first, upload after" use case. We do not 
support uncommitted changes but that was never specifically claimed in the tool.

I'm fine with supporting alternate workflows if desired, as long as the 
"commit" workflow still work.

Original comment by maruel@chromium.org on 15 Feb 2014 at 1:42

GoogleCodeExporter commented 9 years ago
By default the 'git diff' is executed to inspect uncommitted changes. How come 
that default is not the supported workflow?

Original comment by techtonik@gmail.com on 15 Feb 2014 at 4:40

GoogleCodeExporter commented 9 years ago
fyi. I submitted a patch that would fix this, Issue 108430043.

Original comment by sc...@appfirst.com on 15 Jul 2014 at 12:48