Skip to content

A cli-based git-client created in rust as a part of a class project

Notifications You must be signed in to change notification settings

sushruth13/Git-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 

Repository files navigation

Git-client

A cli-based git-client created in rust as a part of a secure programming course project

Version 1: init, add, commit

Version 2: authentication, clone, branch

Version 3: log, add & commit to the remote repo, editor, config, diff

NOTE -

We have replaced PUSH and BLAME feature which were initially listed in our project proposal with other features such as config, branchlist, log and editor tool.

Limitations

  1. Blame requires multiple users to exist in the environment and our local repo does not support that yet. For implementation on remote repo, git2 API only offers latest commit in the commit history and not previous commits, which would be essential to implement blame feature.

  2. There wasnt sufficient documentation on how to handle the remote callbacks in libgit2 which prevented us from implementing PUSH feature.

Compilation instructions and commands:

  1. Download and extract the repository
  2. Use: "docker build -t gitclient ."
  3. Use: "docker images" and copy the gitclient image ID
  4. Use: "docker run -it [imageID]"
  5. Use: "*cargo build"
  6. For authentication setup: "cargo run auth", next "cd .ssh", add the public key to your github account
  7. For authentication verification: "cargo run check-auth", enter "yes" on the prompt
  8. For initialising the git repository: "cargo run init"
  9. For adding a file to staging in local repo: "cargo run add <file-path/file-name>"
  10. For commiting a staged file in local repo: "cargo run commit"
  11. For creating a clone repository: "cargo run clone "
  12. For displaying branch information: "cargo run branch <path_of_test-tmp>"
  13. For displaying the log of the git repo: "cargo run log Cloned-folder"
  14. To add and commit to remote repo: "cargo run git-commit Cloned-folder/ "
  15. Editor to traverse and edit the files in development environment use: "cargo run editor Cloned-folder"
  16. Config to save default username and password use: "cargo run config "
  17. To list number of code changes use:"cargo run diff Cloned-folder/"

To verify the commands:

  1. Verify git init: You should be able to see.GitClient subdirectory inside the container

  2. Verify git add: Before executing the add command, "cd .GitClient/objects" and "ll", notice that there are no objects created yet Create a new file "new.txt": "touch new.txt" "cargo run add new.txt" Got to the objects directory again, and you can see that the blob file is generated for the created file (new.txt)

  3. Verify commit: You will be prompted by the blob hashed IDs and file names on the command prompt

  4. Verify clone: The clone currently works for open repositories only. You can pass the link to the open repository after "cargo run clone" to clone it. Please run "ll" after completion to check for the newly created repo in test-tmp.

  5. Verify branch: Currently, we are storing a cloned repository in the test-tmp folder. On running "cargo run branch test-tmp", we get the names of branches created with the "git branch " command.

  6. About Auth: We have added the support for generating ssh-keys in the ED25519 format. The keys are generated without passphrases currently. We will look into adding this feature in our future version. The ssh keys generated by our client are stored in the default ssh folder ~/.ssh. Please note that the ssh keys should not be visible to other users in the system.

  7. About Authorization verification: The keys generated by the client must be added to the user's account on github.com. Upon successful addition of the ssh keys, the git client allows the user to verify the validity of the ssh keys. This is necessary for the safe cloning of git repositories.

  8. Verify log: The log displays the latest history (user name, email, message and commit id) of commits made to the remote git repository.

  9. Verify git add and commit to the remote repo: This feature adds and commits the file to the remote repository. We can verify this using our log or git log.

  10. Verify editor: This feature helps to traverse through cloned local repository and edit files inside this development environment. Please note we need to install vim on the machine to test the feature.

  11. Verify config: It will create a .env file containing the email id and username.

  12. Verify diff: This feature imitates "git diff --cached ." feature. It will give you a number of insertions, deletions and total files changed in the cloned repository.

About

A cli-based git-client created in rust as a part of a class project

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages