Forum Discussion

nick_georghiou's avatar
10 years ago

Add Git Diffs with path?

Hi,

I am trying to use addgitdiffs with a path to a subdirectory as part of the git command but I get error:



fatal: bad revision '/configuration'



The command I used is as follows (where 'configuration' is a subdirectory of the directory I run the command from):



ccollab addgitdiffs new integration mybranch /configuration



Does addgitdiffs support the <path> option for the git diff command?



Thanks for any advice you can provide,

Nick



  • pratik222's avatar
    pratik222
    New Contributor

    Hi,

    I am also interested in this... 

    can someone from SmartBear please reply if this is supported? 

     

    -Pratik.

  • Git diff itself (see "git help diff") requires a -- between revisions and path(s), and in turn the ccollab client requires that as those options are passed through to git diff.

     

    So for your example, you probably want something like:

     

    ccollab addgitdiffs new integration mybranch -- /configuration  (nb: that would be interpreted as an absolute path... if you mean a directory named "configuration" in your repo, you probably want to omit the slash)

    • gorth5's avatar
      gorth5
      New Contributor

      git diff does not require a '--' between the revisions and path, at least not the way I'm using it.   For example, I can run this command just fine, and it happily displays my diffs.

       

      git diff 3b42 f249 path/to/specific/files

       

      However, running ccollab addgitdiffs new 3b42 f249 path/to/specific/files tries to interpret the path as a revision, and fails.  If I follow your suggestion and add the "--" ...

       

      ccollab addgitdiffs new 3b42 f249 -- path/to/specific/files

       

      I get a different error ...

       

      ERROR: Executing command `ccollab addgitdiffs`:
      There are no diffs to upload

       

      My working directory is clean, but I'm trying to create a review for a diff between two already committed revisions.  It's almost as if code collab is ignoring all the arguments before the path.  However, it only seems to do so if a path is specified.  If I just run this ...

       

      ccollab addgitdiffs new 3b42 f249

       

      It works just fine.  So code collab is definitely mangling something before passing it along to git diff.  Here are my versions of things ...

       

      ccollab --version
      ccollab v9.2.9200

       

      git --version
      git version 1.9.5 (Apple Git-50.3)

       

      • gorth5's avatar
        gorth5
        New Contributor

        I got an email that said someone named 'gudrun735' replied to this thread, but I can't find their reply here.

         

        Anyway, they said that using -- along with absolute paths did allow him to restrict the diff to specific files.  I was able to get this to work as well.  So, for example this would work ...

         

        ccollab addgitdiffs new 384f 9265 -- /absolute/path/to/file

         

        But this would not, even if I was already in the /absolute directory ...

         

        ccollab addgitdiffs new 384f 9265 -- path/to/file

         

        My guess is that ccollab is not running git in the same working directory that you are running ccollab from.  It would be nice if it did, so that running ccollab addgitdiffs <args> will generate the precise diffs generated by running git diff <args> in the current directory.